How to launch conan install from cmake

您所在的位置:网站首页 conan install How to launch conan install from cmake

How to launch conan install from cmake

2022-12-28 17:54| 来源: 网络整理| 查看: 265

How to launch conan install from cmake¶

It is possible to launch conan install from cmake, which can be convenient for end users, package consumers, that are not creating packages themselves.

This is work under testing. Please try it and give feedback or contribute. The CMake code to do this task is here: https://github.com/conan-io/cmake-conan

To be able to use it, you can directly download the code from your CMake script:

CMakeLists.txt¶ cmake_minimum_required(VERSION 2.8) project(myproject CXX) # Download automatically, you can also just copy the conan.cmake file if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake") endif() include(${CMAKE_BINARY_DIR}/conan.cmake) conan_cmake_run(REQUIRES Catch2/2.6.0@catchorg/stable BASIC_SETUP) add_executable(main main.cpp) target_link_libraries(main ${CONAN_LIBS})

If you want to use targets, you could do:

include(conan.cmake) conan_cmake_run(REQUIRES Catch2/2.6.0@catchorg/stable BASIC_SETUP CMAKE_TARGETS) add_executable(main main.cpp) target_link_libraries(main CONAN_PKG::hello)


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3